﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Reflection;

namespace Remind.DALFactory
{
    /// <summary>
    /// 工厂对象
    /// </summary>
    public class DataAccess
    {
        private static readonly string path = ConfigurationManager.AppSettings["AccessDAL"];
        //private static readonly string orderPath = ConfigurationManager.AppSettings["OrdersDAL"];
        private DataAccess() { }

        public static Remind.IDAL.IUser CreateUser()
        {
            string className = path + ".User";
            return (Remind.IDAL.IUser)Assembly.Load(path).CreateInstance(className);
        }

        public static Remind.IDAL.IGroup CreateGroup()
        {
            string className = path + ".Group";
            return (Remind.IDAL.IGroup)Assembly.Load(path).CreateInstance(className);
        }

        public static Remind.IDAL.IContacts CreateContacts()
        {
            string className = path + ".Contacts";
            return (Remind.IDAL.IContacts)Assembly.Load(path).CreateInstance(className);
        }
    }
}
